/*
 * @Author: TC (tengchao@taqu.cn)
 * @Date: 2025-10-11 11:10:33
 * @Last Modified by: TC (tengchao@taqu.cn)
 * @Last Modified time: 2025-10-11 11:18:41
 */

import { _decorator, Node } from "cc";
import { BaseUI } from "db://assets/FrameWork/Module/Component/BaseUI";
import { gameMole } from "../../GameMole";
import { app } from "db://assets/FrameWork/App";
import { EMoleUIConst } from "../../Const/MoleUIConst";
const { ccclass, property } = _decorator;

/**
 * 退出界面
 */
@ccclass("MoleExitUI")
export class MoleExitUI extends BaseUI {
    @property({ type: Node, displayName: "关闭按钮" })
    private btnClose: Node = null;
    @property({ type: Node, displayName: "确认按钮" })
    private btnConfirm: Node = null;

    protected init(): void {
        super.init();
    }

    protected addUIEvent(): void {
        super.addUIEvent();
        this.addClickEvent(this.btnClose, this._onClose);
        this.addClickEvent(this.btnConfirm, this._onConfirm);
    }

    /**
     * 点击关闭
     */
    private _onClose(): void {
        this.closeUI();
    }

    /**
     * 点击确认
     */
    private _onConfirm(): void {
        gameMole.battleMgr.exitBattle()
        this.closeUI();
        app.uiMgr.closeUI(EMoleUIConst.PauseUI);
    }
}
